$(document).ready(function () {
  var password_again = $( "input[name='password_again']" ),
      password = $( "input[name='password']" );
  a = password_again;
  password_again.keyup(function () {
    if (password_again.val() !== password.val()) {
      password_again.parent().addClass('has-error');
    } else {
      password_again.parent().removeClass('has-error');
    }
  });
});


















